package com.gamehall.core;

import java.util.Comparator;

public class TianDaKengSort implements Comparator<TianDaKengPlayer>{

	private int startIndex;
	private int maxNum;
	public TianDaKengSort(int startIndex,int maxNum) {
		this.startIndex = startIndex;
		this.maxNum = maxNum;
	}
	
	@Override
	public int compare(TianDaKengPlayer o1, TianDaKengPlayer o2) {
		int o1SeatNo = o1.getSeatNo();
		int o2SeatNo = o2.getSeatNo();
		if(o1SeatNo < startIndex){
			o1SeatNo += maxNum;
		}
		if(o2SeatNo < startIndex){
			o2SeatNo += maxNum;
		}
		
		if(o1SeatNo < o2SeatNo){
			return -1;
		}
		if(o1SeatNo > o2SeatNo){
			return 1;
		}
		return 0;
	}

	
}
